package com.kcsoft.welcome.mapper;

import com.kcsoft.welcome.pojo.Pfence;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

@Mapper
public interface PfenceMapper {

    @Insert("insert into pfence (name, pf, time) values (#{name}, #{pf}, #{time})")
    void add(Pfence pf);

    @Select("select * from pfence where time = #{date}")
    List<Pfence> list(LocalDate date);

    @Update("update pfence set pf = #{pf} where id = #{id}")
    void udpate(Integer id, Integer pf);

    @Delete("delete from pfence where id = #{id}")
    void delete(Integer id);

    @Select("select distinct time from pfence order by time desc")
    List<LocalDate> dates();
}
